import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

const store = new Vuex.Store({
    state: {
        //loginFlag: null, //默认没有登录
        loginFlag: sessionStorage.getItem("currentLoginStatus") ? sessionStorage.getItem("currentLoginStatus"):null, //默认没有登录
        loginSuccessUser: localStorage.getItem("currentLoginUserInfo")?JSON.parse(localStorage.getItem("currentLoginUserInfo")):null
    },
    mutations: {
        initLoginFlag(state, value) {
            state.loginFlag = value;
        }
    },
    actions: {
        actionInitLoginFlag(context, value) {
            context.commit("initLoginFlag", value);
        }
    }
})

export default store;